# Create your views here.
from django.conf.urls.defaults import *
from django.template import Context, loader
from django.http import HttpResponse
from django.contrib.auth.decorators import login_required

from pyweb.books.models import Book


@login_required(redirect_field_name='redirect_to')
def index(request):
    book_list = Book.objects.all().order_by('name')
    t = loader.get_template('books/index.html')
    c = Context({'book_list':book_list,'user':request.user})
    return HttpResponse(t.render(c))

def detail(request, book_id):
    pass
